home *** CD-ROM | disk | FTP | other *** search
- on exitFrame
- global gNumPlayers, gNullCast, gVoiceChannel, gPathToSound, fileDelimiter, gSoundFXChannel
- set jScore1 to integer(the text of field "player1 score")
- set jScore2 to integer(the text of field "player2 score")
- set jScore3 to integer(the text of field "player3 score")
- set jWinner to 0
- case gNumPlayers of
- 2:
- if jScore1 > jScore2 then
- set jWinner to 1
- else
- if jScore1 < jScore2 then
- set jWinner to 2
- end if
- end if
- 3:
- if jScore1 > jScore2 then
- if jScore1 > jScore3 then
- set jWinner to 1
- else
- if jScore3 > jScore1 then
- set jWinner to 3
- end if
- end if
- else
- if jScore2 > jScore1 then
- if jScore2 > jScore3 then
- set jWinner to 2
- else
- if jScore3 > jScore2 then
- set jWinner to 3
- end if
- end if
- else
- if (jScore3 > jScore2) and (jScore3 > jScore1) then
- set jWinner to 3
- end if
- end if
- end if
- end case
- if not (the puppet of sprite 3) then
- puppetSprite(3, 1)
- end if
- if not (the puppet of sprite 4) then
- puppetSprite(4, 1)
- end if
- if gNumPlayers = 1 then
- set the memberNum of sprite 3 to the number of member "Game Over text"
- set the memberNum of sprite 4 to gNullCast
- else
- if jWinner = 0 then
- set the memberNum of sprite 3 to the number of member "Tie Game text"
- set the memberNum of sprite 4 to gNullCast
- else
- set the memberNum of sprite 3 to the number of member "Winner is text"
- set the memberNum of sprite 4 to the number of member "player name not editable"
- set the text of field "player name not editable" to the text of field ("name" & jWinner)
- updateStage()
- sound playFile gVoiceChannel, gPathToSound & "winner" & fileDelimiter & "winris" & jWinner & ".aif"
- sound playFile gSoundFXChannel, gPathToSound & "soundFX" & fileDelimiter & getAt(["liteclap", "medclap", "loudclap"], random(3)) & ".aif"
- end if
- end if
- case gNumPlayers of
- 1:
- if jScore1 > 1000 then
- if random(2) - 1 then
- set jAudioFile to "R5005.aif"
- else
- set jAudioFile to "R5006.aif"
- end if
- else
- set jAudioFile to "R5004.aif"
- end if
- 2:
- if (jScore1 < 1) and (jScore2 < 1) then
- set jAudioFile to "R6007.aif"
- else
- if jScore1 > jScore2 then
- if random(2) - 1 then
- set jAudioFile to "R6002_2.aif"
- else
- set jAudioFile to "R6003.aif"
- end if
- else
- if jScore1 < jScore2 then
- if random(2) - 1 then
- set jAudioFile to "R6002.aif"
- else
- set jAudioFile to "R6004.aif"
- end if
- else
- set jAudioFile to "R6001.aif"
- end if
- end if
- end if
- 3:
- if (jScore1 < 0) and (jScore2 < 0) and (jScore3 < 0) then
- set jAudioFile to "R7001.aif"
- else
- if (jScore1 > 1000) and (jScore2 > 1000) and (jScore3 > 1000) then
- if random(2) - 1 then
- set jAudioFile to "R7004.aif"
- else
- set jAudioFile to "R7005.aif"
- end if
- else
- set jAudioFile to "R6001.aif"
- end if
- end if
- end case
- repeat while soundBusy(gVoiceChannel)
- end repeat
- sound playFile gVoiceChannel, gPathToSound & "rules" & fileDelimiter & jAudioFile
- displayScores()
- end
-